import { ref, watch } from "vue";
import type DashboardComponentType from "../commons/types/dashboard-component-type";

/**
 * 使用控制台打印
 * @param handle  日志输出
 */
export default function useVisualProperty<T>(props: any, activeKeyList = []) {
    const activeKey = ref<string[]>([
        "baseProperty",
        "styleProperty",
        "compOptionProperty",
        ...activeKeyList
    ]);

    const propData = ref<DashboardComponentType<T>>();

    watch(
        () => props.compData,
        () => {
            propData.value = props.compData;
        },
        { deep: true, immediate: true }
    );

    return {
        activeKey,
        propData
    }
}